package com.zhkj.crawl.bean;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

@Data
@Slf4j
public class FetchPhpParams {
    private Integer size = 20;

    public static FetchPhpParams init(String param) {
        if(StringUtils.isNotBlank(param)){
            try {
                return JSON.toJavaObject(JSON.parseObject(param), FetchPhpParams.class);
            }catch (Exception e){
                log.error("入参错误" + param, e);
            }
        }
        return DEFAULT;
    }

    public static FetchPhpParams DEFAULT = new FetchPhpParams();
}
